namespace Vanilla.UI

import Vanilla

import System.Runtime.InteropServices
import System

// CAIRO BINDINGS
private class Cairo:
	// IMAGE SURFACES
	[DllImport("cairo", EntryPoint:"cairo_surface_write_to_png")]
	public static def SurfaceWriteToPNG (s as IntPtr, f as string):
		pass
	[DllImport("cairo", EntryPoint:"cairo_image_surface_create")]
	public static def ImageSurfaceCreate (f as BitmapCanvas.Format, w as int, h as int) as IntPtr:
		pass
	[DllImport("cairo", EntryPoint:"cairo_image_surface_create_for_data")]
	public static def ImageSurfaceCreateForData (data as IntPtr, f as BitmapCanvas.Format, w as int, h as int, stride as int) as IntPtr:
		pass
	[DllImport("cairo", EntryPoint:"cairo_image_surface_create_from_png")]
	public static def ImageSurfaceCreateFromPNG (f as string) as IntPtr:
		pass
	[DllImport("cairo", EntryPoint:"cairo_image_surface_get_width")]
	public static def ImageSurfaceGetWidth (c as IntPtr) as int:
		pass
	[DllImport("cairo", EntryPoint:"cairo_image_surface_get_height")]
	public static def ImageSurfaceGetHeight (c as IntPtr) as int:
		pass
	[DllImport("cairo", EntryPoint:"cairo_image_surface_get_data")]
	public static def ImageSurfaceGetData (c as IntPtr) as IntPtr:
		pass
	
	// CAIRO CONTEXTS
	[DllImport("cairo", EntryPoint:"cairo_create")]
	public static def Create (surface as IntPtr) as IntPtr:
		pass
	[DllImport("cairo", EntryPoint:"cairo_clip_extents")]
	public static def ClipExtents (c as IntPtr, ref x1 as double, ref y1 as double, ref x2 as double, ref y2 as double):
		pass
	
	// PROPERTIES
	[DllImport("cairo", EntryPoint:"cairo_get_line_width")]
	public static def GetLineWidth (c as IntPtr) as double:
		pass
	[DllImport("cairo", EntryPoint:"cairo_set_line_width")]
	public static def SetLineWidth (c as IntPtr, w as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_set_source")]
	public static def SetSource (c as IntPtr, p as IntPtr):
		pass
	
	// DRAWING
	[DllImport("cairo", EntryPoint:"cairo_move_to")]
	public static def MoveTo (c as IntPtr, x as double, y as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_rel_move_to")]
	public static def RelMoveTo (c as IntPtr, x as double, y as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_line_to")]
	public static def LineTo (c as IntPtr, x as double, y as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_curve_to")]
	public static def CurveTo (c as IntPtr, x1 as double, y1 as double, x2 as double, y2 as double, x3 as double, y3 as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_set_source_rgba")]
	public static def SetSourceRGBA (c as IntPtr, r as double, g as double, b as double, a as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_close_path")]
	public static def ClosePath (c as IntPtr):
		pass
	
	// TRANSLATE / ROTATE / ..
	[DllImport("cairo", EntryPoint:"cairo_translate")]
	public static def Translate (c as IntPtr, x as double, y as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_rotate")]
	public static def Rotate (c as IntPtr, r as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_scale")]
	public static def Scale (c as IntPtr, x as double, y as double):
		pass
	
	// FONTS
	[DllImport("cairo", EntryPoint:"cairo_select_font_face")]
	public static def SelectFontFace (c as IntPtr, f as string, s as FontSlant, w as FontWeight):
		pass
	[DllImport("cairo", EntryPoint:"cairo_set_font_size")]
	public static def SetFontSize (c as IntPtr, s as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_show_text")]
	public static def ShowText (c as IntPtr, s as string):
		pass
	[DllImport("cairo", EntryPoint:"cairo_text_extents")]
	public static def TextExtents (c as IntPtr, s as string, ref e as TextExtents):
		pass
	
	// PATTERNS
	[DllImport("cairo", EntryPoint:"cairo_pattern_create_linear")]
	public static def PatternCreateLinear (x as double, y as double, x2 as double, y2 as double) as IntPtr:
		pass
	[DllImport("cairo", EntryPoint:"cairo_pattern_add_color_stop_rgba")]
	public static def PatternAddColorStopRGBA (p as IntPtr, offset as double, r as double, g as double, b as double, a as double):
		pass
	[DllImport("cairo", EntryPoint:"cairo_pattern_create_for_surface")]
	public static def PatternCreateForSurface (s as IntPtr) as IntPtr:
		pass
	
	// STROKE / FILL / PAINT / CLIP
	[DllImport("cairo", EntryPoint:"cairo_stroke")]
	public static def Stroke (c as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_fill")]
	public static def Fill (c as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_paint")]
	public static def Paint (c as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_clip")]
	public static def Clip (c as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_stroke_preserve")]
	public static def StrokePreserve (c as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_fill_preserve")]
	public static def FillPreserve (c as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_clip_preserve")]
	public static def ClipPreserve (c as IntPtr):
		pass
		
	// SAVE / RESTORE
	[DllImport("cairo", EntryPoint:"cairo_save")]
	public static def Save (c as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_restore")]
	public static def Restore (c as IntPtr):
		pass
	
	// DESTRUCTORS
	[DllImport("cairo", EntryPoint:"cairo_surface_destroy")]
	public static def SurfaceDestroy (s as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_destroy")]
	public static def Destroy (c as IntPtr):
		pass
	[DllImport("cairo", EntryPoint:"cairo_pattern_destroy")]
	public static def PatternDestroy (p as IntPtr):
		pass
